<?php

namespace app\common\validate;

use think\Validate;

class UserValidate extends Validate
{
	/**
	 * 验证规则
	 * @var [array]
	 */
	protected $rule = [
        'uid|用户id' => 'require',
        'username|用户名' => 'require',
        'mobile|手机号' => 'require|mobile',
        'password|密码' => 'require|min:6|max:12',
        'repassword|确认密码' => 'require',
        'email|邮箱' => 'require|email',
        'vcode|验证码' => 'require',
        'msg' => 'require',
        'ids' => 'require'
    ];

    /**
     * 后台登录
     * @Author   Yichen
     * @DateTime 2020-05-03T22:03:32+0800
     * @return   [type]                   [description]
     */
    public function sceneLogin()
    {
        return $this->only(['username', 'password']);
    }

    /**
     * 添加用户验证场景
     * @Author   fanzhongxing
     * @DateTime 2020-05-01T00:28:35+0800
     * @return   [type]                   [description]
     */
    public function sceneAdd()
    {
    	return $this->only(['username', 'mobile', 'password', 'repassword']);
    }

    /**
     * 修改信息验证场景
     * @Author   fanzhongxing
     * @DateTime 2020-05-01T15:21:19+0800
     * @return   [type]                   [description]
     */
    public function sceneEdit()
    {
        return $this->only(['uid', 'username', 'mobile']);
    }

    /**
     * 删除用户验证场景
     * @Author   fanzhongxing
     * @DateTime 2020-05-01T14:46:53+0800
     * @return   [type]                   [description]
     */
    public function sceneDel()
    {
        return $this->only(['uid']);
    }

    /**
     * 批量删除
     * @Author   fanzhongxing
     * @DateTime 2020-05-01T18:01:10+0800
     * @return   [type]                   [description]
     */
    public function sceneDelAll()
    {
        return $this->only(['ids']);
    }

    /**
     * 禁用或启用
     * @Author   fanzhongxing
     * @DateTime 2020-05-01T16:17:38+0800
     * @return   [type]                   [description]
     */
    public function sceneProOrEna()
    {
        return $this->only(['msg', 'uid']);
    }

    /**
     * 官网登录
     * @Author   Yichen
     * @DateTime 2020-05-04T15:06:12+0800
     * @return   [type]                   [description]
     */
    public function sceneUserLogin()
    {
        return $this->only(['mobile', 'password']);
    }

    /**
     * 前台注册
     * @Author   Yichen
     * @DateTime 2020-05-04T15:22:13+0800
     * @return   [type]                   [description]
     */
    public function sceneRegister()
    {
        return $this->only(['username', 'mobile', 'email', 'password', 'repassword', 'vcode']);
    }

    /**
     * 获取邮箱验证码
     * @Author   Yichen
     * @DateTime 2020-05-04T16:17:35+0800
     * @return   [type]                   [description]
     */
    public function sceneEmailCode() 
    {
        return $this->only(['email']);
    }
}